﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using NUnit.Framework;
using System.Diagnostics;

namespace Twitter.Tests
{
	[TestFixture]
	public class BotClientFixture : TestBase
	{
		[ExpectedException(typeof(ArgumentNullException))]
		[Test]
		public void ShouldThrowIfNullCredentials()
		{
			new BotClient((ICredentials)null);
		}

		[ExpectedException(typeof(ArgumentNullException))]
		[Test]
		public void ShouldThrowIfNullExecuteCommand()
		{
			new BotClient(TestRun.BotCredentials).Execute(null);
		}

		[ExpectedException(typeof(ArgumentException))]
		[Test]
		public void ShouldThrowIfEmptyExecuteCommand()
		{
			new BotClient(TestRun.BotCredentials).Execute("");
		}

		[Test]
		public void ShouldPingBot()
		{
			Assert.IsTrue(new BotClient(TestRun.BotCredentials).Ping());
		}

		[Test]
		public void ShouldFailPingBot()
		{
			Assert.IsFalse(new BotClient(TestRun.BotCredentials, "http://foo/").Ping());
		}

		[Test]
		public void ShouldGetProfile()
		{
			var client = new BotClient(TestRun.BotCredentials);
			var user = client.GetProfile(TestRun.ClientScreenName);

			Assert.IsNotNull(user);
		}
	}
}
